<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>
    
    字符数组的输入和输出 - DSRBLOG
    
  </title>
  

  
  
  <link href="atom.xml" rel="alternate" title="DSRBLOG" type="application/atom+xml">
  <link rel="stylesheet" href="asset/css/style.min.css">
  <link rel="stylesheet" href="asset/css/doc.css">
  <script src="asset/app.js"></script>


</head>

<body> <section class="ct-body">
	<div class="container">
		<div class="columns is-variable bd-klmn-columns is-4 is-centered">
			<div class="column is-four-fifths">
				<div class="post-body single-content">
					
					<h1 class="title">
						字符数组的输入和输出
					</h1>


					<div class="media">
						
						
						<div class="media-content">
							<div class="content">
								<p>
									<span class="date">2022/01/11 23:42 下午</span>
									

									

									<br />
									<span class="tran-tags">Tags:</span>&nbsp;
									
									<a class="tag is-link is-light">#C语言</a>
									

								</p>
							</div>
						</div>

					</div>
				</div>
				<article class="markdown-body single-content">
					<h2><a id="gets%EF%BC%9A" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>gets()：</h2>
<ul>
<li>其作用是从终端输入一个字符串到字符数组，并且得到一个函数值
<h3><a id="%E4%B8%80%E8%88%AC%E5%BD%A2%E5%BC%8F%EF%BC%9A" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>一般形式：</h3>
<pre class="line-numbers"><code class="language-c">gets(字符数组)
</code></pre>
</li>
</ul>
<h2><a id="puts%EF%BC%9A" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>puts()：</h2>
<ul>
<li>其作用是将一个字符数组（以\0结束的字符序列）输出到终端
<h3><a id="%E4%B8%80%E8%88%AC%E5%BD%A2%E5%BC%8F%EF%BC%9A" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>一般形式：</h3>
<pre class="line-numbers"><code class="language-c">puts(字符数组)
</code></pre>
</li>
</ul>
<p><strong>注意：</strong> 使用<code>gets()</code>、<code>puts()</code>函数只能输入或输出一个字符串，不能写成 <code>gets(str1, str2)</code> 或 <code> puts(str1, str2)</code></p>

				</article>
				<div class="comments-wrap">
					<div class="share-comments">
						

						

						
					</div>
				</div><!-- end comments wrap -->
			</div>
		</div><!-- end columns -->
	</div><!-- end container -->
</section>  














<script src="asset/prism.js"></script>









</body>

</html>